package com.zhxymm.book.service;

import com.zhxymm.book.dao.NewBookRepository;
import com.zhxymm.book.entity.NewBook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewBookService {

    @Autowired
    NewBookRepository newBookRepository;

    public NewBook save(NewBook newBook){
        return  newBookRepository.save(newBook);
    }

    public List<NewBook> getAll(){
        return newBookRepository.findAll();
    }

    public NewBook findByNewBookId(long theId){
        return newBookRepository.findByNewBookId(theId);
    }

    public void delete (NewBook theNewBook){
        newBookRepository.delete(theNewBook);
    }
}
